Optimal. Leaf size=175 \[ -\frac {b \left (2 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {2 b^2 \left (A b^2+a^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 \sqrt {a-b} \sqrt {a+b} d}+\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.43, antiderivative size = 173, normalized size of antiderivative = 0.99, number of steps
used = 7, number of rules used = 6, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {4190, 4189,
4004, 3916, 2738, 214} \begin {gather*} -\frac {b x \left (\frac {2 A b^2}{a^2}+A+2 C\right )}{2 a^2}-\frac {A b \sin (c+d x) \cos (c+d x)}{2 a^2 d}+\frac {2 b^2 \left (a^2 C+A b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 d \sqrt {a-b} \sqrt {a+b}}+\frac {\left (a^2 (2 A+3 C)+3 A b^2\right ) \sin (c+d x)}{3 a^3 d}+\frac {A \sin (c+d x) \cos ^2(c+d x)}{3 a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 4004
Rule 4189
Rule 4190
Rubi steps
\begin {align*} \int \frac {\cos ^3(c+d x) \left (A+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx &=\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}-\frac {\int \frac {\cos ^2(c+d x) \left (3 A b-a (2 A+3 C) \sec (c+d x)-2 A b \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{3 a}\\ &=-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}+\frac {\int \frac {\cos (c+d x) \left (2 \left (3 A b^2+\frac {1}{2} a^2 (4 A+6 C)\right )+a A b \sec (c+d x)-3 A b^2 \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{6 a^2}\\ &=\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}-\frac {\int \frac {3 b \left (2 A b^2+a^2 (A+2 C)\right )+3 a A b^2 \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{6 a^3}\\ &=-\frac {b \left (2 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}+\frac {\left (b^2 \left (A b^2+a^2 C\right )\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^4}\\ &=-\frac {b \left (2 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}+\frac {\left (b \left (A b^2+a^2 C\right )\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^4}\\ &=-\frac {b \left (2 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}+\frac {\left (2 b \left (A b^2+a^2 C\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^4 d}\\ &=-\frac {b \left (2 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {2 b^2 \left (A b^2+a^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 \sqrt {a-b} \sqrt {a+b} d}+\frac {\left (3 A b^2+a^2 (2 A+3 C)\right ) \sin (c+d x)}{3 a^3 d}-\frac {A b \cos (c+d x) \sin (c+d x)}{2 a^2 d}+\frac {A \cos ^2(c+d x) \sin (c+d x)}{3 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.52, size = 149, normalized size = 0.85 \begin {gather*} \frac {-6 b \left (2 A b^2+a^2 (A+2 C)\right ) (c+d x)-\frac {24 b^2 \left (A b^2+a^2 C\right ) \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+3 a \left (4 A b^2+a^2 (3 A+4 C)\right ) \sin (c+d x)-3 a^2 A b \sin (2 (c+d x))+a^3 A \sin (3 (c+d x))}{12 a^4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 225, normalized size = 1.29
method | result | size |
derivativedivides | \(\frac {\frac {2 b^{2} \left (A \,b^{2}+a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{4} \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {2 \left (\frac {\left (-A \,a^{3}-\frac {1}{2} A \,a^{2} b -a A \,b^{2}-a^{3} C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {2}{3} A \,a^{3}-2 a A \,b^{2}-2 a^{3} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-A \,a^{3}-a A \,b^{2}-a^{3} C +\frac {1}{2} A \,a^{2} b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {b \left (A \,a^{2}+2 A \,b^{2}+2 a^{2} C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}\right )}{a^{4}}}{d}\) | \(225\) |
default | \(\frac {\frac {2 b^{2} \left (A \,b^{2}+a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{4} \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {2 \left (\frac {\left (-A \,a^{3}-\frac {1}{2} A \,a^{2} b -a A \,b^{2}-a^{3} C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {2}{3} A \,a^{3}-2 a A \,b^{2}-2 a^{3} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-A \,a^{3}-a A \,b^{2}-a^{3} C +\frac {1}{2} A \,a^{2} b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {b \left (A \,a^{2}+2 A \,b^{2}+2 a^{2} C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}\right )}{a^{4}}}{d}\) | \(225\) |
risch | \(-\frac {A b x}{2 a^{2}}-\frac {b^{3} x A}{a^{4}}-\frac {b x C}{a^{2}}-\frac {3 i A \,{\mathrm e}^{i \left (d x +c \right )}}{8 a d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} A \,b^{2}}{2 a^{3} d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} C}{2 a d}+\frac {3 i A \,{\mathrm e}^{-i \left (d x +c \right )}}{8 a d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} A \,b^{2}}{2 a^{3} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} C}{2 a d}+\frac {b^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d \,a^{4}}+\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,a^{2}}-\frac {b^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d \,a^{4}}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,a^{2}}+\frac {A \sin \left (3 d x +3 c \right )}{12 a d}-\frac {A b \sin \left (2 d x +2 c \right )}{4 a^{2} d}\) | \(487\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.52, size = 483, normalized size = 2.76 \begin {gather*} \left [-\frac {3 \, {\left ({\left (A + 2 \, C\right )} a^{4} b + {\left (A - 2 \, C\right )} a^{2} b^{3} - 2 \, A b^{5}\right )} d x - 3 \, {\left (C a^{2} b^{2} + A b^{4}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - {\left (2 \, {\left (2 \, A + 3 \, C\right )} a^{5} + 2 \, {\left (A - 3 \, C\right )} a^{3} b^{2} - 6 \, A a b^{4} + 2 \, {\left (A a^{5} - A a^{3} b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (A a^{4} b - A a^{2} b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{6} - a^{4} b^{2}\right )} d}, -\frac {3 \, {\left ({\left (A + 2 \, C\right )} a^{4} b + {\left (A - 2 \, C\right )} a^{2} b^{3} - 2 \, A b^{5}\right )} d x - 6 \, {\left (C a^{2} b^{2} + A b^{4}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (2 \, {\left (2 \, A + 3 \, C\right )} a^{5} + 2 \, {\left (A - 3 \, C\right )} a^{3} b^{2} - 6 \, A a b^{4} + 2 \, {\left (A a^{5} - A a^{3} b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (A a^{4} b - A a^{2} b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{6} - a^{4} b^{2}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \cos ^{3}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 326 vs.
\(2 (158) = 316\).
time = 0.51, size = 326, normalized size = 1.86 \begin {gather*} -\frac {\frac {3 \, {\left (A a^{2} b + 2 \, C a^{2} b + 2 \, A b^{3}\right )} {\left (d x + c\right )}}{a^{4}} - \frac {12 \, {\left (C a^{2} b^{2} + A b^{4}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} a^{4}} - \frac {2 \, {\left (6 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 4 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 12 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 12 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3} a^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.61, size = 2500, normalized size = 14.29 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________